package acwing.二分;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * @description:
 * @author: qian
 * @createDate: 2021/11/20
 */
public class 四平方和 {


//    static int N = 5000000;
//    static int n;
//    public static void main(String[] args) {
//        Scanner s = new Scanner(System.in);
//        n = s.nextInt();
//
//        for (int a = 0; a * a <= n; a++) {
//            for (int b = a; a * a + b * b <= n; b++) {
//                for (int c = b; a * a + b * b + c * c <= n; c++) {
//                    int t = n - a * a - b * b - c * c;
//                    int d =(int) Math.sqrt(t);
//                    if (d * d == t) {
//                        System.out.println(a +" " + b + " " + c + " " + d);
//                        return;
//                    }
//                }
//            }
//        }
//    }


    static int N = 5000000, n;

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        n = s.nextInt();
        Map<Integer, int[]> map = new HashMap<>();

        for (int c = 0; c * c <= n; c++) {
            for (int d = c; c * c + d * d <= n; d++) {
                Integer n = c * c + d * d;
                if (map.get(n) == null) {
                    map.put(n,new int[]{c,d});
                }
            }
        }
        for (int a = 0; a * a <=n; a++) {
            for (int b = a; a * a + b * b <= n; b++) {
                int res = n - a * a - b * b;
                if (map.get(res) != null) {
                    int c = map.get(res)[0];
                    int d = map.get(res)[1];
                    System.out.print( a + " " + b + " " + c + " "+ d);
                    return;
                }
            }
        }
    }

}
